using CsvHelper.Configuration.Attributes;

namespace InverseTree
{
    public class Node
    {
        public int Id { get; set; }
        public int Value { get; set; }

        public int? LeftChild { get; set; }

        public int? RightChild { get; set; }

        public Node GetLeftChildNode()
        {
            if (LeftChild != null)
                if (Program.records.ContainsKey(LeftChild.Value))
                {
                    return Program.records[LeftChild.Value];
                }
            return null;

        }

        public Node GetRightChildNode()
        {
            if (RightChild != null)
                if (Program.records.ContainsKey(RightChild.Value))
            {
                return Program.records[RightChild.Value];
            }
            return null;
        }
    }
}
